-
Notifications
You must be signed in to change notification settings - Fork 2
Bilayer support #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: append_sample
Are you sure you want to change the base?
Bilayer support #292
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## append_sample #292 +/- ##
=================================================
+ Coverage 88.10% 88.29% +0.19%
=================================================
Files 45 46 +1
Lines 2471 2597 +126
Branches 288 307 +19
=================================================
+ Hits 2177 2293 +116
+ Misses 233 232 -1
- Partials 61 72 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
jfkcooper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically only one comment on the code parts, and easily rectified. I will run the notebook now and give you feedback on this, but doing it in github is not fun for notebooks, so I submit these comments now
|
Thinking on it, I would also use this as a way to demonstrate mutliple contrasts for the lipid model, so using H2O as the solvent and subphase as well as D2O, and then showing the SLD curves, and the reflectivity curves (and the ability to set the constraints between the two models (or however you would put the models together). The most common use case of the lipid bilayer would be for fitting mulitple contrast (water) data. |
|
Addressed the code issues and modified the notebook to reflect Jos' comments. |
|
Thanks for the changes, though I just noticed a couple more things:
Let me know if you want a chat about any of these points, and thanks again for the progress! |
henrikjacobsenfys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments and questions
|
|
||
| def __init__( | ||
| self, | ||
| front_head_layer: Optional[LayerAreaPerMolecule] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move towards | typing in new files? Or keep things consistent within a project?
| layer is created internally with parameters constrained to this one. | ||
| :param back_head_layer: Layer representing the back head part of the bilayer. | ||
| :param name: Name for bilayer, defaults to 'EasyBilayer'. | ||
| :param constrain_heads: Constrain head layer thickness and area per molecule, defaults to `True`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constrain in what way?
| unique_name = global_object.generate_unique_name(self.__class__.__name__) | ||
|
|
||
| # Create default front head layer if not provided | ||
| if front_head_layer is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to put these default values or the constructor in a defaults file and generate them from there, passing onlythe unique_name? To make them easier to maintain across files
| unique_name: Optional[str] = None, | ||
| constrain_heads: bool = True, | ||
| conformal_roughness: bool = True, | ||
| interface=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should interface have a type?
| interface=interface, | ||
| ) | ||
|
|
||
| # Store the front tail layer reference for constraint setup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and back tail
| self.conformal_roughness = True | ||
|
|
||
| def _setup_tail_constraints(self) -> None: | ||
| """Setup constraints so back tail layer parameters depend on front tail layer.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are identical to? At least from what I can tell.
| self.layers[0] = layer | ||
|
|
||
| @property | ||
| def front_tail_layer(self) -> Optional[LayerAreaPerMolecule]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that self.layers[1] is identical to self._front_tail_layer? This seems like it may be problematic if they get out of sync? Not sure how it works, just wanted to point it out
| if unique_name is None: | ||
| unique_name = global_object.generate_unique_name(self.__class__.__name__) | ||
|
|
||
| # Create default front head layer if not provided |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be its own little method? _create_default_front_head_layer to make the init a bit shorter? (Also applies elsewhere)
| ) | ||
|
|
||
| # Constrain area per molecule | ||
| back_tail._area_per_molecule.make_dependent_on( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use a public method instead? Also elsewhere.

As requested and described by @jfkcooper this is the library implementation of bilayers in EasyReflectometryLib.
Please scrutinize
docs\tutorials\simulation\bilayer.ipynbfor correctness and API.